<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<p id = "p1">这是p1</p>
<button onclick="func01()">执行func01</button>
<button onclick="func02('wen',18)">执行func02</button>
<button onclick="this.innerHTML=Date()">时间</button>
<script>
    function func01() {
        document.getElementById("p1").innerHTML = "这是执行后的func01"
    }

    function func02(name,age) {
        window.alert(name+age)
    }
    //函数内不用var申明的变量 属于全局变量
    //函数内用var申明
    var a = 1;
    b = 1;
    function func03() {
        console.log(a);
        var a = 3;
        console.log(a)
    }
    func03();
    console.log(a);

    //this 当前环境
    //箭头函数与普通函数关于this的区别
    console.log(this)

    var obj = {
        a:10,
            c: () => {
            console.log(this.a);
        },
        b: function() {
            console.log(this.a);
        }
    };
    obj.b();
    obj.c();

</script>

</body>
</html>